package org.sanelli.InterstellarGolf.SpecificObject;

import org.sanelli.InterstellarGolf.R;
import org.sanelli.InterstellarGolf.GenericObject.BoundingBox;
import org.sanelli.InterstellarGolf.GenericObject.GameEntity;
import org.sanelli.InterstellarGolf.GenericObject.Vector2D;
import org.sanelli.InterstellarGolf.Util.Scaling;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;

public class GameNPC extends GameEntity {
	private double _mass;
	
	public GameNPC(Context context) {
		super();
		_mass = 0;
		this._bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.icon);
	}
	
	public GameNPC(Context context, Vector2D position) {
		super();
		_mass = 0;
		this._bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.nothin);
		this._bitmap = Bitmap.createScaledBitmap(_bitmap, 50, 50, false);
		this._position = position;
		this._bb = new BoundingBox(position.getX() - this._bitmap.getWidth()/2, position.getY() - this._bitmap.getHeight()/2, position.getX() + this._bitmap.getWidth()/2, position.getY() + this._bitmap.getHeight()/2);
	}

	public double getMass() {
		return _mass;
	}

	public void setMass(double _mass) {
		this._mass = _mass;
	}

	@Override
	public void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		Vector2D where = Scaling.WorldToScreen(this._bb.getP1());
		canvas.drawBitmap(this._bitmap, (int)where.getX(), (int)where.getY(), null);
	}

	@Override
	public String toString() {
		return "Position " + this._position.toString();
	}
}
